package com.hzdesk.media.koreabatchmatvector.logic.view;

import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.hzdesk.media.koreabatchmatvector.R;
import com.hzdesk.media.koreabatchmatvector.logic.contract.MouseListContract;
import com.hzdesk.media.koreabatchmatvector.logic.persenter.MouseListPersenter;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by Administrator on 2018/7/9.
 * 杭州席媒科技有限公司  Developers  刘传华  10
 * 佛祖镇楼 bug辟易
 * <p>
 * TODO: 2018/7/10                                                                               批注功能
 */

public class MouseListActivity extends BaseActivity implements MouseListContract.IMouseListView {
    @BindView(R.id.activity_mouse_list_iv_back)
    ImageView activityMouseListIvBack;
    @BindView(R.id.activity_mouse_list_recyclerview)
    RecyclerView activityMouseListRecyclerview;
    @BindView(R.id.activity_mouse_list_ll_bg)
    LinearLayout activityMouseListLlBg;

    private MouseListPersenter mMouseListPersenter = new MouseListPersenter(this);

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_mouse_list);
        ButterKnife.bind(this);
        initView();
    }

    private void initView() {
        activityMouseListIvBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                mMouseListPersenter.oncklicedBack();
            }
        });
        mMouseListPersenter.initDate(activityMouseListRecyclerview, this);
    }

    @Override
    public void toMouseSetPager(int postion) {
        Intent intent = new Intent(this, ChangeMouseSetActivity.class);
        intent.putExtra("item_postion", postion);
        startActivity(intent);
    }

    @Override
    public void toFinshPager() {
        finish();
    }

    @Override
    protected void onStart() {
        super.onStart();
        final SharedPreferences mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
        int selector = mSharedPreferences.getInt("item_skin", 0); //todo 名称
        activityMouseListLlBg.setBackgroundResource(updateBg[selector]);
    }
}
